package com.boot.persistence.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.boot.persistence.condition.QueryCondition;
import com.boot.persistence.model.BaseModel;
import com.boot.web.http.HttpModel;
import org.springframework.http.ResponseEntity;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @description Control层接口
 * @date 2019/7/24 14:39
 **/
public interface IController<Id extends Serializable, T extends BaseModel<Id>, Service> {

    ResponseEntity<HttpModel<T>> selectById(Id id, String useStrict);

    ResponseEntity<HttpModel<T>> selectOne(@NotNull T model, String useStrict);

    ResponseEntity<HttpModel<Collection<T>>> selectByIds(@NotEmpty List<Id> list, String useStrict);

    ResponseEntity<HttpModel<IPage<T>>> select(@NotNull QueryCondition<Id, T> condition);

    ResponseEntity<HttpModel<IPage<T>>> selectLike(@NotNull QueryCondition<Id, T> condition);

    ResponseEntity<HttpModel<IPage<T>>> selectAll();

    ResponseEntity<HttpModel<Long>> selectCount(@NotNull T model);

    ResponseEntity<HttpModel<Id>> insertRecord(@NotNull T model);

    ResponseEntity<HttpModel<List<Id>>> insertRecords(@NotEmpty List<T> list);

    ResponseEntity<HttpModel<Id>> saveRecord(@NotNull T model);

    ResponseEntity<HttpModel<List<Id>>> saveRecords(@NotEmpty List<T> list);

    ResponseEntity<HttpModel<Void>> updateRecord(@NotNull T model);

    ResponseEntity<HttpModel<Void>> updateRecords(@NotEmpty List<T> list);

    ResponseEntity<HttpModel<Void>> deleteById(Id id, String useStrict);

    ResponseEntity<HttpModel<Void>> deleteByIds(@NotEmpty List<Id> list, String useStrict);

    Service getService();
}
